import request from '@/utils/request'
import type {
  OrderPre,
  AddressItem,
  MedicineOrderParams,
  OrderDetail,
  Logistics
} from '@/types/order'
// 获取药品信息
export const getMedicineOrderPre = (params: { prescriptionId: string }) =>
  request<OrderPre>('/patient/medicine/order/pre', 'GET', params)

// 获取地址
export const getAddress = () => request<AddressItem[]>('/patient/order/address')

// 生成订单编号
export const getMedicineOrderNo = (data: MedicineOrderParams) =>
  request<{ id: string }>('/patient/medicine/order', 'POST', data)

// 获取订单详情
export const getMedicineOrderDetail = (id: string) =>
  request<OrderDetail>(`/patient/medicine/order/detail/${id}`)

// 获取物流信息
export const getLogistics = (id: string) =>
  request<Logistics>(`/patient/order/${id}/logistics`)
